﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

namespace TowerDefence
{
    public class SpawnScene : MonoBehaviour
    {
        public GameObject pf; // 预制体对象
        public GameObject spawnPoint; // 生成点对象

        float countdown = 5; // 倒计时时间

        public void Update()
        {
            if (countdown <= 0)
            {
                countdown = 5; // 重置倒计时
                SpawnObject(); // 生成对象
            }
            else
            {
                countdown -= Time.deltaTime; // 更新倒计时
            }
        }

        public void SpawnObject()
        {
            // 在生成点位置生成预制体对象
            GameObject spawnedObject = Instantiate(pf, spawnPoint.transform.position, pf.transform.rotation);
        }

    }
}
